package com.zhny.aiot.led.four.screen.plugin;

import com.zhny.aiot.led.four.screen.plugin.config.LedConfig;
import com.zhny.aiot.led.four.screen.plugin.device.LedDevice;
import com.zhny.aiot.led.four.screen.plugin.model.LedStoreEntry;
import com.zhny.aiot.plugin.ICenterFacilities;
import com.zhny.aiot.plugin.IDevice;
import com.zhny.aiot.plugin.model.DeviceEntity;
import com.zhny.aiot.plugin.model.FactoryType;
import com.zhny.aiot.plugin.model.StoreEntity;
import com.zhny.aiot.plugin.udc.UdcServer;
import com.zhny.aiot.plugin.udc.device.UdcDeviceFactory;
import org.pf4j.Extension;
import org.pf4j.Plugin;
import org.pf4j.PluginWrapper;

public class LedPlugin extends Plugin {
    public LedPlugin(PluginWrapper wrapper) {
        super(wrapper);
    }
    @Extension
    public static class LedFactory extends UdcDeviceFactory<LedConfig> {
        @Override
        public Class<LedConfig> configClass() {
            return LedConfig.class;
        }

        public IDevice createDevice(ICenterFacilities iCenterFacilities, DeviceEntity entity) {
            return new LedDevice(UdcServer.getInstance().getEngine(), this, iCenterFacilities, entity);
        }

        public Class<? extends StoreEntity> storeClass() {
            return LedStoreEntry.class;
        }

        public String getId() {
            return "led-screen-plugin";
        }

        public String getName() {
            return "LED字符卡插件";
        }

        public FactoryType getType() {
            return FactoryType.Led;
        }
    }
}
